package com.zsg.webview.Activities;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;

import com.zsg.webview.Adapter.CommantAdapter;

/**
 * 用来显示评论 的线性布局
 * Created by zzc on 2015/11/14.
 */
public class MyLinearLayout extends LinearLayout{
    CommantAdapter adapter;
    public MyLinearLayout(Context context) {
        this(context, null);
    }

    public MyLinearLayout(Context context, AttributeSet attrs) {
        super(context, attrs);

    }


    public void initAdapter(CommantAdapter adapter){
        this.adapter=adapter;
        initView();
    }

    //重洗初始化 视图
    public void initView(){
        removeAllViews();
        //将适配器中每一项视图添加到 视图中
        for(int i=0;i<adapter.getCount();i++) {
            View view = adapter.getView(i, null, null);
            addView(view, i);
        }

    }
}
